const Base = require('./base.js');
const fs = require('fs');
const _ = require('lodash');
const moment = require('moment');
module.exports = class extends Base {
    async infoAction() {
        // const value = this.post('value');
        const info = await this.model('user').where({id:think.userId})
        .field('nickname, name, username, gender, birthday, register_time, last_login_time,  mobile,  avatar, name_mobile, country, province, city, integral, f_integral')
        .find();
        if(info.birthday) info.birthday = moment.unix(info.birthday).format('YYYY-MM-DD');
        info.register_time = moment.unix(info.register_time).format('YYYY-MM-DD HH:mm:ss');
        info.last_login_time = moment.unix(info.last_login_time).format('YYYY-MM-DD HH:mm:ss');
        info.nickname = Buffer.from(info.nickname, 'base64').toString();
        return this.success(info);
    }
};